#if (!XBOX)
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
#endregion

namespace KLib
{
    public class CustomPropery<T> : ExpandableObjectConverter
    {
        #region Methods
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            if (sourceType == typeof(string))
                return true;

            return base.CanConvertFrom(context, sourceType);
        }

        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(T))
                return true;
            return base.CanConvertTo(context, destinationType);
        }

        /*public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            //MSDN says I need to change this, but it seems to be working fine without the changes
            //If I find I need to, the instructions are at http://msdn.microsoft.com/en-us/library/aa302326.aspx
            //http://msdn.microsoft.com/en-us/library/aa302334.aspx also contains better examples
        }*/

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string) && value is T)
            {
                T val = (T)value;

                PropertyInfo[] properties = val.GetType().GetProperties();
                string returnVal = String.Empty; ;

                for (int i = 0; i < properties.Length; i++)
                {
                    if (i > 0)
                        returnVal += ", " + properties[i].Name + ":" + properties[i].GetValue(val,null);
                    else
                        returnVal += properties[i].Name + ":" + properties[i].GetValue(val, null);
                }
                return returnVal;
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }
        #endregion
    }
}
#else
    public class CustomProperty<T>
    {
        //PlaceHolder for Xbox
    }
#endif